// System Unit
// Pascal Set Support

(*************)
(* Interface *)
(*************)
{$IFDEF Include_Modules_Header}

 Procedure _SetElem(Var Dest {:Set}; Elem, Size: Integer);
 Type RTLProc_SetElem = Procedure(Var Dest {:Set}; Elem, Size: Integer);

 Procedure _SetRange(Lo, Hi, Size: Integer; Var Dest {:Set});
 Type RTLProc_SetRange = Procedure(Lo, Hi, Size: Integer; Var Dest {:Set});

 Function _SetEq(Const L, R {:Set}; Size: Integer): Boolean;
 Type RTLProc_SetEq = Function(Const L, R {:Set}; Size: Integer): Boolean;

 Function _SetLe(Const L, R {:Set}; Size: Integer): Boolean;
 Type RTLProc_SetLe = Function(Const L, R {:Set}; Size: Integer): Boolean;

 Procedure _SetIntersect(Var Dest {:Set}; Const Src {:Set}; Size: Integer);
 Type RTLProc_SetIntersect = Procedure(Var Dest {:Set}; Const Src {:Set}; Size: Integer);

 Procedure _SetIntersect3(Var Dest {:Set}; Const L, R {:Set}; Size: Integer);
 Type RTLProc_SetIntersect3 = Procedure(Var Dest {:Set}; Const L, R {:Set}; Size: Integer);

 Procedure _SetUnion(Var Dest {:Set}; Const Src {:Set}; Size: Integer);
 Type RTLProc_SetUnion = Procedure(Var Dest {:Set}; Const Src {:Set}; Size: Integer);

 Procedure _SetUnion3(Var Dest {:Set}; Const L, R {:Set}; Size: Integer);
 Type RTLProc_SetUnion3 = Procedure(Var Dest {:Set}; Const L, R {:Set}; Size: Integer);

 Procedure _SetSub(Var Dest {:Set}; Const Src {:Set}; Size: Integer);
 Type RTLProc_SetSub = Procedure(Var Dest {:Set}; Const Src {:Set}; Size: Integer);

 Procedure _SetSub3(Var Dest {:Set}; Const L, R {:Set}; Size: Integer);
 Type RTLProc_SetSub3 = Procedure(Var Dest {:Set}; Const L, R {:Set}; Size: Integer);

 Procedure _SetExpand(Const Src {:Set}; Var Dest {:Set}; Lo, Hi: Integer);
 Type RTLProc_SetExpand = Procedure(Const Src {:Set}; Var Dest {:Set}; Lo, Hi: Integer);

 //==================
 // RTL Extensions
 //==================
 Type
  TRTLEx_Set = Record
   _SetElem: RTLProc_SetElem;
   _SetRange: RTLProc_SetRange;
   _SetEq: RTLProc_SetEq;
   _SetLe: RTLProc_SetLe;
   _SetIntersect: RTLProc_SetIntersect;
   _SetIntersect3: RTLProc_SetIntersect3;
   _SetUnion: RTLProc_SetUnion;
   _SetUnion3: RTLProc_SetUnion3;
   _SetSub: RTLProc_SetSub;
   _SetSub3: RTLProc_SetSub3;
   _SetExpand: RTLProc_SetExpand;
  END;

 Procedure RTLExtend_Set(Var Ex: TRTLEx_Set);

{$ENDIF Include_Modules_Header}
(******************)
(* Implementation *)
(******************)
{$IFDEF Include_Modules_Implement}

 Procedure _RTL_SetElem(Var Dest {:Set}; Elem, Size: Integer);
  ASM
   JMP _INT_NotImplemented
  END;

 Procedure _RTL_SetRange(Lo, Hi, Size: Integer; Var Dest {:Set});
  ASM
   JMP _INT_NotImplemented
  END;

 Function _RTL_SetEq(Const L, R {:Set}; Size: Integer): Boolean;
  ASM
   JMP _INT_NotImplemented
  END;

 Function _RTL_SetLe(Const L, R {:Set}; Size: Integer): Boolean;
  ASM
   JMP _INT_NotImplemented
  END;

 Procedure _RTL_SetIntersect(Var Dest {:Set}; Const Src {:Set}; Size: Integer);
  ASM
   JMP _INT_NotImplemented
  END;

 Procedure _RTL_SetIntersect3(Var Dest {:Set}; Const L, R {:Set}; Size: Integer);
  ASM
   JMP _INT_NotImplemented
  END;

 Procedure _RTL_SetUnion(Var Dest {:Set}; Const Src {:Set}; Size: Integer);
  ASM
   JMP _INT_NotImplemented
  END;

 Procedure _RTL_SetUnion3(Var Dest {:Set}; Const L, R {:Set}; Size: Integer);
  ASM
   JMP _INT_NotImplemented
  END;

 Procedure _RTL_SetSub(Var Dest {:Set}; Const Src {:Set}; Size: Integer);
  ASM
   JMP _INT_NotImplemented
  END;

 Procedure _RTL_SetSub3(Var Dest {:Set}; Const L, R {:Set}; Size: Integer);
  ASM
   JMP _INT_NotImplemented
  END;

 Procedure _RTL_SetExpand(Const Src {:Set}; Var Dest {:Set}; Lo, Hi: Integer);
  ASM
   JMP _INT_NotImplemented
  END;

 Var
  RTL_SetElem: RTLProc_SetElem = _RTL_SetElem;
  RTL_SetRange: RTLProc_SetRange = _RTL_SetRange;
  RTL_SetEq: RTLProc_SetEq = _RTL_SetEq;
  RTL_SetLe: RTLProc_SetLe = _RTL_SetLe;
  RTL_SetIntersect: RTLProc_SetIntersect = _RTL_SetIntersect;
  RTL_SetIntersect3: RTLProc_SetIntersect3 = _RTL_SetIntersect3;
  RTL_SetUnion: RTLProc_SetUnion = _RTL_SetUnion;
  RTL_SetUnion3: RTLProc_SetUnion3 = _RTL_SetUnion3;
  RTL_SetSub: RTLProc_SetSub = _RTL_SetSub;
  RTL_SetSub3: RTLProc_SetSub3 = _RTL_SetSub3;
  RTL_SetExpand: RTLProc_SetExpand = _RTL_SetExpand;

 Procedure _SetElem(Var Dest {:Set}; Elem, Size: Integer);
  ASM
   JMP RTL_SetElem
  END;

 Procedure _SetRange(Lo, Hi, Size: Integer; Var Dest {:Set});
  ASM
   JMP RTL_SetRange
  END;

 Function _SetEq(Const L, R {:Set}; Size: Integer): Boolean;
  ASM
   JMP RTL_SetEq
  END;

 Function _SetLe(Const L, R {:Set}; Size: Integer): Boolean;
  ASM
   JMP RTL_SetLe
  END;

 Procedure _SetIntersect(Var Dest {:Set}; Const Src {:Set}; Size: Integer);
  ASM
   JMP RTL_SetIntersect
  END;

 Procedure _SetIntersect3(Var Dest {:Set}; Const L, R {:Set}; Size: Integer);
  ASM
   JMP RTL_SetIntersect3
  END;

 Procedure _SetUnion(Var Dest {:Set}; Const Src {:Set}; Size: Integer);
  ASM
   JMP RTL_SetUnion
  END;

 Procedure _SetUnion3(Var Dest {:Set}; Const L, R {:Set}; Size: Integer);
  ASM
   JMP RTL_SetUnion3
  END;

 Procedure _SetSub(Var Dest {:Set}; Const Src {:Set}; Size: Integer);
  ASM
   JMP RTL_SetSub
  END;

 Procedure _SetSub3(Var Dest {:Set}; Const L, R {:Set}; Size: Integer);
  ASM
   JMP RTL_SetSub3
  END;

 Procedure _SetExpand(Const Src {:Set}; Var Dest {:Set}; Lo, Hi: Integer);
  ASM
   JMP RTL_SetExpand
  END;

 //==================
 // RTL Extensions
 //==================

 Procedure RTLExtend_Set(Var Ex: TRTLEx_Set);
  BEGIN
   _INT_RTL_DoEx(@RTL_SetElem, @Ex._SetElem);
   _INT_RTL_DoEx(@RTL_SetRange, @Ex._SetRange);
   _INT_RTL_DoEx(@RTL_SetEq, @Ex._SetEq);
   _INT_RTL_DoEx(@RTL_SetLe, @Ex._SetLe);
   _INT_RTL_DoEx(@RTL_SetIntersect, @Ex._SetIntersect);
   _INT_RTL_DoEx(@RTL_SetIntersect3, @Ex._SetIntersect3);
   _INT_RTL_DoEx(@RTL_SetUnion, @Ex._SetUnion);
   _INT_RTL_DoEx(@RTL_SetUnion3, @Ex._SetUnion3);
   _INT_RTL_DoEx(@RTL_SetSub, @Ex._SetSub);
   _INT_RTL_DoEx(@RTL_SetSub3, @Ex._SetSub3);
   _INT_RTL_DoEx(@RTL_SetExpand, @Ex._SetExpand);
  END;

{$ENDIF Include_Modules_Implement}
(******************)
(* Initialization *)
(******************)
{$IFDEF Include_Modules_Initialize}
{$ENDIF Include_Modules_Initialize}
(****************)
(* Finalization *)
(****************)
{$IFDEF Include_Modules_Finalize}
{$ENDIF Include_Modules_Finalize}
